package Frames;
// importa pacotes e componentes necessarios para rodar recursos do java
import java.io.IOException;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.skin.OfficeSilver2007Skin;
import org.pushingpixels.substance.api.skin.SubstanceBusinessLookAndFeel;

public class MenuPrincipal extends javax.swing.JFrame {

    public MenuPrincipal() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        menuBar = new javax.swing.JMenuBar();
        menuCadastro = new javax.swing.JMenu();
        subCliente = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        subFuncionario = new javax.swing.JMenuItem();
        menuServicos = new javax.swing.JMenu();
        subOrdemS = new javax.swing.JMenuItem();
        subReciboS = new javax.swing.JMenuItem();
        menuUltilitarios = new javax.swing.JMenu();
        subCalculadora = new javax.swing.JMenuItem();
        menuAjuda = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Click Computadores");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        desktopPane.setBackground(new java.awt.Color(204, 204, 204));

        menuCadastro.setText("Cadastro");

        subCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/cliente-icon-24.png"))); // NOI18N
        subCliente.setText("Clientes e Fornecedor");
        subCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subClienteActionPerformed(evt);
            }
        });
        menuCadastro.add(subCliente);
        menuCadastro.add(jSeparator1);

        subFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Profile.png"))); // NOI18N
        subFuncionario.setText("Funcionario");
        subFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subFuncionarioActionPerformed(evt);
            }
        });
        menuCadastro.add(subFuncionario);

        menuBar.add(menuCadastro);

        menuServicos.setText("Serviços");

        subOrdemS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Modify.png"))); // NOI18N
        subOrdemS.setText("Ordem de Serviços");
        subOrdemS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subOrdemSActionPerformed(evt);
            }
        });
        menuServicos.add(subOrdemS);

        subReciboS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Modify.png"))); // NOI18N
        subReciboS.setText("Recibo de Saida");
        subReciboS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subReciboSActionPerformed(evt);
            }
        });
        menuServicos.add(subReciboS);

        menuBar.add(menuServicos);

        menuUltilitarios.setText("Ultilitários");

        subCalculadora.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/calculator-icon.png"))); // NOI18N
        subCalculadora.setText("Calculadora");
        subCalculadora.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subCalculadoraActionPerformed(evt);
            }
        });
        menuUltilitarios.add(subCalculadora);

        menuBar.add(menuUltilitarios);

        menuAjuda.setText("Ajuda");
        menuBar.add(menuAjuda);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 680, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void subClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subClienteActionPerformed
        // botão que abri o a tela de Cadastro de Cliente e Fornecedor.
        CadastroCliente cadastro = new CadastroCliente();
        desktopPane.add(cadastro);
        cadastro.setVisible(true);

    }//GEN-LAST:event_subClienteActionPerformed

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        // ajusta o tamanho da janela (jFrame).
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setSize(new java.awt.Dimension(1000, 700));
        setLocation((screenSize.width - 1000) / 2, (screenSize.height - 700) / 2);
    }//GEN-LAST:event_formWindowActivated

    private void subCalculadoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subCalculadoraActionPerformed
        // comando que chama a calculadora do windows.
        try {
            Runtime.getRuntime().exec("calc.exe");
        } catch (IOException ix) {
            ix.printStackTrace();
        }
    }//GEN-LAST:event_subCalculadoraActionPerformed

    private void subFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subFuncionarioActionPerformed
        // botão que abri a tela de Cadastro de Funcionario.
        CadastroUsuario cadastro = new CadastroUsuario();
        desktopPane.add(cadastro);
        cadastro.setVisible(true);
    }//GEN-LAST:event_subFuncionarioActionPerformed

    private void subOrdemSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subOrdemSActionPerformed
        // botão que abri a tela de Cadastro de Serviço (Ordem de Serviço OS).
        Servicos servicos = new Servicos();
        desktopPane.add(servicos);
        servicos.setVisible(true);
    }//GEN-LAST:event_subOrdemSActionPerformed

    private void subReciboSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subReciboSActionPerformed
        ReciboSaida recibo = new ReciboSaida();
        desktopPane.add(recibo);
        recibo.setVisible(true);
    }//GEN-LAST:event_subReciboSActionPerformed

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                // comando que bota um tema no jFrame.
                try {
                    UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
                    SubstanceLookAndFeel.setSkin(new OfficeSilver2007Skin());
                } catch (UnsupportedLookAndFeelException ex) {
                    ex.printStackTrace();
                }
                new MenuPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JMenu menuAjuda;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenu menuCadastro;
    private javax.swing.JMenu menuServicos;
    private javax.swing.JMenu menuUltilitarios;
    private javax.swing.JMenuItem subCalculadora;
    private javax.swing.JMenuItem subCliente;
    private javax.swing.JMenuItem subFuncionario;
    private javax.swing.JMenuItem subOrdemS;
    private javax.swing.JMenuItem subReciboS;
    // End of variables declaration//GEN-END:variables
}
